<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>


    <button id="jian">-</button>
    <input type="text" value="1" id="tet">
    <button id="jia">+</button>
    <b style="font-weight: normal;">单价:9.99元&emsp;总价:<strong style="color:red;font-weight: normal;"
            id="jj">9.99</strong>元</b>
    <script>
        var a = tet.value;
        jian.onclick = function () {

            a.value = a--;
            var b = 9.99 * a;
            jj.innerHTML = b;

            if (a < 1) {
                tet.value = 1;
                alert('产品数量不能小于1')
            }
        }

        jia.onclick = function () {
            a.value = a++;
            var b = 9.99 * a;
            jj.innerHTML = b;

            if (a > 10) {
                tet.value = 10;
                alert('产品限购10件')
            }
        }
    </script>
</body>

</html>